<?php
class hieulib_System_Plugin extends Zend_Controller_Plugin_Abstract
{
	 
	public function preDispatch(Zend_Controller_Request_Abstract $request){

		/*
		 * Kiem tra xem co phai dang truy phan Admin hay khong
		*/
		$moduleName = $request->getModuleName();

		
		//var_dump($controllerName);
		$flagAdmin = false;
		if($moduleName == 'admin'){
			$flagAdmin = true;
		}else{
			$tmp = explode('-', $moduleName);
			if(current($tmp) == 'admin'){
				$flagAdmin = true;
			}
		}


		if($flagAdmin){

			$request->setModuleName('default');
			$request->setControllerName('public');
			$request->setActionName('login');

		}
	}

}